package com.portal.config.mq;

import com.portal.constant.MQConst;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfig {

    // 创建队列
    @Bean
    public Queue queue() {
        return new Queue("email.queue");
    }

    @Bean
    public Queue clearCartQueue() {
        return new Queue(MQConst.CLEAR_CART_QUEUE);
    }

    // 创建消息转换器
    @Bean
    public MessageConverter messageConverter() {
        return new Jackson2JsonMessageConverter();
    }
}
